<template>
  <div id="app">
    <sidebar :nav=nav></sidebar>
    <div class="main">
      <router-view @navList='navList'/>
    </div>
  </div>
</template>

<script>
import Sidebar from '@/pages/sidebar'
export default {
  name: 'App',
  data(){
    return {
      nav:[],
      indexNav:[
          {nav:'主页',id:'home'},
          {nav:'添加',id:'add'},
          {nav:'关于',id:'about'},
          {nav:'退出登录',id:"out"},
      ],
      loginNav:[
            {nav:'登陆',id:'login'},
            {nav:'注册',id:'register'},
            {nav:'关于',id:'about'}]
    }
  },
  components:{
    Sidebar
  },
  methods:{
    navList(code){
      if(code==0){
        this.nav = this.loginNav
      }else{
        this.nav = this.indexNav
      }
    }
  }
}
</script>

<style>
*{
    margin: 0;
    padding: 0;
}
html,body,#app {height: 100%;overflow-x: hidden;}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;
}
.main{
  float: right;
  width: 80%;
  height: 100%;
}
</style>
